//为 ‘-’绑定点击事件
function min(){

    var buyNum = document.getElementById("number").value;

    var num = parseInt(buyNum);
    if(num >1){
        document.getElementById("number").value = num - 1;
    }
}


//为 ‘+’绑定点击事件
function add(){

    var buyNum = document.getElementById("number").value;

    var num = parseInt(buyNum);

    document.getElementById("number").value = num + 1;
}

//为购买数量输入框 绑定失去焦点事件
function blurFn(obj){
    //获取用户输入的购买数量
    var buyNum = obj.value;
    //isNaN: is not a number
    if(isNaN(buyNum) || buyNum <1){
        obj.value = 1;
    }else{
        //进行向上取整  1==》1    1.1 ==》2
        obj.value = Math.ceil(obj.value);
    }
}